programming4us
           
 
 
Windows

Windows 7 : Controlling and Customizing Your Website (part 5) - Viewing the Server Logs

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019
3/23/2011 9:34:33 AM

Viewing the Server Logs

After your web server is chugging along and serving pages to all and sundry, you might start to wonder which pages are popular with surfers and which ones are languishing. You might also want to know whether users are getting errors when they try to access your site.

You can tell all of this and more by working with the IIS logs. A log is a text file that records all the activity on your website, including the IP address and computer name (if applicable) of the surfer, the file that was served, the date and time the file was shipped to the browser, and the server return code (see the next Note box). For each server request, the log file writes a sequence of space-separated values, which makes it easy to import the file into a database or spreadsheet program for analysis.

The log files are stored in the \inetpub\logs\LogFiles\W3SVC1 folder of your Windows 7 system drive. (As you navigate to this folder, you may see one or two dialog boxes telling you that you don’t have permission to open a particular folder. In each case, click Continue and enter your UAC credentials.)

Each filename takes the form u_exyymmdd.log, where yy is the two-digit year, mm is the two-digit month, and dd is the two-digit day. For example, the log for August 23, 2008 would be stored in u_ex080823.log. Figure 8 shows a typical log file.

Figure 8. A typical IIS log file.

At first glance, an IIS log file appears to be nothing but a jumble of letters, numbers, and symbols. However, there’s a bit of method in the apparent madness. First, know that each line (that is, each line that doesn’t begin with #) represents an object that IIS served. This could be a file, and image, or some other content on the website. Second, remember that each field is separated by a space. Third, notice the #Fields line, which appears from time to time in the log:

#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) sc-status sc-substatus sc-win32-status


This line tells you the name of each log field. To help you make sense of what you’re looking at, Table 1 gives you a summary of what you see in each field.

Table 1. Description of the Fields Found in an IIS Log File
FieldDescription
dateThe date on which the item (file or folder) was served.
timeThe time at which the item was served.
s-ipThe IP address of the computer that’s running the web server.
cs-methodThe method used to request the item. (This is almost always GET.)
cs-uri-stemThe name of the requested item.
cs-uri-queryThe query used to generate the item request. (This will usually be blank, represented by a dash.)
s-portThe port used to exchange the data. (This will always be 80.)
cs-usernameThe name—and sometimes the computer name—of the authenticated user. You only see values in this field if you turn on basic authentication for the website or a folder.
c-ipThe IP address of the user who requested the item.
cs(User-Agent)A string that identifies the user’s web browser.
sc-statusA code that specifies whether the request was handled successfully and, if not, what the error was.
sc-substatusA secondary error code if the request failed.
sc-win32-statusThe Windows status during the request.

Server Return Codes

A sc-status code of 200 means the document was sent successfully to the browser. For unsuccessful operations, here’s a summary of some of the return codes you’ll find in the log:

Return CodeWhat It Means
204File contains no content
301File moved permanently
302File moved temporarily
304File not modified
400Bad request
401Unauthorized access
402Payment required
403Access forbidden
404File not found
500Internal server error
501Service not implemented
502Bad gateway
503Service unavailable
Other -----------------
- Windows 7 : Adding Folders and Files to the Default Website (part 3) - Adding a Folder to the Default Website
- Windows 7 : Adding Folders and Files to the Default Website (part 2) - Changing the Default Website Home Page
- Windows 7 : Adding Folders and Files to the Default Website (part 1) - Setting Permissions on the Default Website Folder
- Turning Windows 7 into a Web Server : Understanding the Default Website
- Turning Windows 7 into a Web Server : Accessing Your Website
- Windows 7 : Installing Internet Information Services
- Windows 7 : Using Virtual Private Network Connections
- Windows 7 : Using Dynamic DNS to Access Your Network & Configuring a Network Computer for Remote Administration
- Windows 7 : Connecting to a Remote Desktop via the Internet
- Windows 7 : Connecting to the Remote Desktop (part 2) - Making an Advanced Connection
- Windows 7 : Connecting to the Remote Desktop (part 1) - Making a Basic Connection
- Windows 7 : Setting Up the Remote Computer as a Host (part 2) - Configuring XP to Act as a Remote Desktop Host
- Windows 7 : Setting Up the Remote Computer as a Host (part 1) - Configuring Windows 7 or Vista to Act as a Remote Desktop Host
- Windows 7 : Working with Network Files Offline (part 6) - Dealing with Synchronization Conflicts
- Windows 7 : Working with Network Files Offline (part 5) - Synchronizing Your Offline Files
- Windows 7 : Working with Network Files Offline (part 4) - Working with Network Files While You’re Offline
- SOA with .NET and Windows Azure : WCF Discovery (part 3) - Discovery Proxies for Managed Discovery & Implicit Service Discovery
- SOA with .NET and Windows Azure : WCF Discovery (part 2) - Locating a Service Ad Hoc & Sending and Receiving Service Announcements
- SOA with .NET and Windows Azure : WCF Discovery (part 1) - Discovery Modes
- Windows 7 : Working with Network Files Offline (part 3) - Prohibiting a Network Folder from Being Made Available Offline & Encrypting Offline Files
 
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
- First look: Apple Watch

- 3 Tips for Maintaining Your Cell Phone Battery (part 1)

- 3 Tips for Maintaining Your Cell Phone Battery (part 2)
programming4us programming4us